package cn.houseProperty.contoller;

import cn.entity.Do.Suite;
import cn.entity.Status;
import cn.houseProperty.service.impl.SuiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Stack;

@Controller
@RequestMapping("/admin/Suite")
public class SuiteContoller {
    @Autowired
    private SuiteService suiteService;

    @ResponseBody
    @GetMapping("/getSuiteByBid")
    public Status getSuiteByBid(String bid){
        Status status = new Status();
        status.setFlag(true);
        status.setData(suiteService.selectByBid(bid));
        return status;
    }

    @ResponseBody
    @GetMapping("selectAll")
    public Status selectAll(){
        Status status = new Status();
        List<Suite> suites = suiteService.selectAll();
        if (suites != null) {
            status.setFlag(true);
            status.setData(suites);
            return status;
        }else {
            status.setFlag(false);
            status.setMessage("错误");
            return status;
        }
    }
}
